package com.zw.knowlege.mapper;

import com.zw.knowlege.pojo.CollectRecordPojo;
import com.zw.knowlege.pojo.ExperiencePojo;
import org.apache.ibatis.annotations.Param;

import java.sql.Timestamp;
import java.util.List;
import java.util.Map;

/**
 * @Author xtyu
 * @Date 2022/5/9
 * @description 经验基础信息表Mapper
 */
public interface ExperienceBaseMapper {
    /**
     * 插入经验
     * @param experiencePojo
     * @return
     */
    int insertExperienceBase(ExperiencePojo experiencePojo);

    /**
     * 获取历史发布过的状态
     * @param experienceid
     * @return
     */
    int queryReleaseStatus(@Param("experienceid") String experienceid);
    /**
     * 更新经验的状态
     * @param status
     * @param experienceid
     * @return
     */
    int updateExperienceStatus(@Param("status") Integer status, @Param("updatetime") Timestamp updatetime, @Param("experienceid") String experienceid);

    /**
     * 更新经验信息
     * @param experiencePojo
     * @return
     */
    int updateExperienceBase(ExperiencePojo experiencePojo);

    /**
     * 获取版本号
     * @param experienceid
     * @return
     */
    int getExperienceVersion(@Param("experienceid") String experienceid);

    /**
     * 首页查询
     * @param paramMap
     * @return
     */
    List<ExperiencePojo> queryExperienceHomePage(Map<String, Object> paramMap);
    /**
     * 我的经验-只看最新版本的
     * @param paramMap
     * @return
     */
    List<ExperiencePojo> queryNewVersionExperience(Map<String, Object> paramMap);

    /**
     * 查询经验详情
     * @param experienceId
     * @return
     */
    ExperiencePojo queryExperienceDetails(@Param("experienceid") String experienceId);
    /**
     * 查询经验的所有版本信息
     * @param experienceId
     * @return
     */
    List<Map<String, Object>> queryExperienceVersionList(@Param("experienceid") String experienceId);

    /**
     * 更新基础信息的收藏数
     * @param experienceId
     * @param updateType
     * @return
     */
    int updateCollectCount(@Param("experienceId") String experienceId, @Param("updateType") String updateType);

    /**
     * 通过ID进行IN查询
     * @param collectRecord
     * @return
     */
    List<ExperiencePojo> queryExperienceByInId(@Param("condition") List<CollectRecordPojo> collectRecord);

    /**
     * 查询垂直筛选的字典吗
     * @param userid
     * @return
     */
    List<ExperiencePojo> querySelectDict(@Param("userid") String userid);

}
